package com.msb.Phone;

/**
 * @author weifuqiang
 * @create_time 2022/6/1
 */
public class Phone {
    private String brand;
    private double price;
    private int year;

    public Phone() {

    }

    public Phone(String brand, double price, int year) {
        this.brand = brand;
        this.price = price;
        this.year = year;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    @Override
    public String toString() {
        return "Phone{" +
                "brand='" + brand + '\'' +
                ", price=" + price +
                ", year=" + year +
                '}';
    }


    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Phone){
            Phone ohter = (Phone)obj;
            return this.getBrand().equals(ohter.getBrand()) &&
                    this.getPrice() == ohter.getPrice() &&
                    this.getYear() == ohter.getYear();
        }
        return false;
    }
}
